//2. 对象的解构
const zhao = {
    name: '赵本山',
    age: '不详',
    xiaopin: function(){
        console.log("我可以演小品");
    }
};

let {name, age, xiaopin} = zhao;
console.log(name); // 赵本山
console.log(age); // 不详
console.log(xiaopin); // [Function: xiaopin]
xiaopin(); // 我可以演小品


// 复杂解构
let wangfei = {
    name: "王菲",
    age: 18,
    songs: ['红豆','流年','暧昧','传奇'],
    history: [
        {
            name : '窦唯'
        },
        {
            name: '李亚鹏'
        },
        {
            name: '谢霆锋'
        }
    ]
};

let {songs: [one,two,three], history: [first,second,third]} = wangfei;

console.log(one);   // 红豆
console.log(two);   // 流年
console.log(three); // 暧昧
console.log(first); // { name: '窦唯' }
console.log(second); // { name: '李亚鹏' }
console.log(third); // { name: '谢霆锋' }




















